package com.ruoyi.cs.event.customeroffer.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.List;

/**
 * 客户报价
 * cs_customer_offer
 * @author Drj 2021/6/28
 */
public class CustomerOffer extends BaseEntity {

    /**
     * 客户报价编号
     */
    @NotNull(message = "客户报价编号不能为空")
    @ApiModelProperty(value = "客户报价编号", required = true)
    private String customerQuotaId;
    /**
     * 客户编号
     */
    @NotNull(message = "客户编号不能为空")
    @ApiModelProperty(value = "客户编号", required = true)
    private String customerInfoId;
    /**
     * 客户名称
     */
    private String customerInfoName;
    /**
     * 经手人编号
     */
    private String staffId;
    /**
     * 经手人名称
     */
    private String staffName;
    /**
     * 预计销售总金额
     * list内金额总和
     */
    private Double saleExpectAmountTotal;
    /**
     * 报价时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private java.sql.Timestamp offerTime;
    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private java.sql.Timestamp createTime;
    /**
     * 备注
     */
    private String remark;
    /**
     * 客户报价详细
     */
    List<CustomerOfferList> customerOfferLists;

    public List<CustomerOfferList> getCustomerOfferLists() {
        return customerOfferLists;
    }

    public void setCustomerOfferLists(List<CustomerOfferList> customerOfferLists) {
        BigDecimal bigDecimalSEAT = new BigDecimal("0");//预计销售总金额
        for (int i = 0; i < customerOfferLists.size(); i++) {
            bigDecimalSEAT = bigDecimalSEAT.add(new BigDecimal(customerOfferLists.get(i).getSaleExpectAmount()));
        }
        setSaleExpectAmountTotal(bigDecimalSEAT.doubleValue());
        this.customerOfferLists = customerOfferLists;
    }

    public String getCustomerQuotaId() {
        return customerQuotaId;
    }

    public void setCustomerQuotaId(String customerQuotaId) {
        this.customerQuotaId = customerQuotaId;
    }

    public String getCustomerInfoId() {
        return customerInfoId;
    }

    public void setCustomerInfoId(String customerInfoId) {
        this.customerInfoId = customerInfoId;
    }

    public String getCustomerInfoName() {
        return customerInfoName;
    }

    public void setCustomerInfoName(String customerInfoName) {
        this.customerInfoName = customerInfoName;
    }

    public String getStaffId() {
        return staffId;
    }

    public void setStaffId(String staffId) {
        this.staffId = staffId;
    }

    public String getStaffName() {
        return staffName;
    }

    public void setStaffName(String staffName) {
        this.staffName = staffName;
    }

    public Double getSaleExpectAmountTotal() {
        return saleExpectAmountTotal;
    }

    public void setSaleExpectAmountTotal(Double saleExpectAmountTotal) {
        this.saleExpectAmountTotal = saleExpectAmountTotal;
    }

    public Timestamp getOfferTime() {
        return offerTime;
    }

    public void setOfferTime(Timestamp offerTime) {
        this.offerTime = offerTime;
    }

    @Override
    public String getRemark() {
        return remark;
    }

    @Override
    public void setRemark(String remark) {
        this.remark = remark;
    }

    @Override
    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }
}
